package com.itheima.mall.service.sms;

import com.itheima.mall.api.ums.SmsFlashPromotionProductRelationApi;
import com.itheima.mall.dto.ListDtoPage;
import com.itheima.mall.pojo.sms.SmsFlashPromotionProductRelation;
import com.itheima.mall.vo.PageResult;
import com.itheima.mall.vo.R;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SmsFlashPromotionProductRelationService {
    /**
     * 批量添加商品关联
     */
    @DubboReference
    SmsFlashPromotionProductRelationApi relationApi;
    public void addRelation(List<SmsFlashPromotionProductRelation> relations) {
        relationApi.addRelation(relations);
    }

    public void deleteRelation(Long id) {
        relationApi.deleteRelation(id);
    }

    /**
     * 分页查询
     * @param flashPromotionId
     * @param flashPromotionSessionId
     * @param pageNum
     * @param pageSize
     * @return
     */
    public PageResult getList(Integer flashPromotionId,
                              Integer flashPromotionSessionId, int pageNum, int pageSize) {
        PageResult list = relationApi.getList(flashPromotionId, flashPromotionSessionId, pageNum, pageSize);
        return list;


    }

    public void updateRelation(SmsFlashPromotionProductRelation relation1) {
        relationApi.updateRelation(relation1);
    }

    public SmsFlashPromotionProductRelation getRelation(Integer id) {
        SmsFlashPromotionProductRelation relation = relationApi.getRelation(id);
        return relation;
    }
}
